//
//  MachineList.swift
//  vmes
//
//  Created by 志鹏 翟 on 2021/11/22.
//

import Foundation

struct MachineData: Codable {
    let code : Int?
    let data : MachineItem?
    let msg : String?
}

struct MachineList: Codable {
    let code : Int?
    let rows : [MachineItem]?
    let msg : String?
}

struct MachineItem :Codable {
    let brandId : String?
    let compId : String?
    let equipCode : String?
    let equipName : String?
    let equipSpec : String?
    let factoryDate : String?
    let factoryNumber : String?
    let id : String?
    let originPlace : String?
    let powerKw : String?
    let remarkInfo : String?
    let statusFlag : String?
    let statusName : String?
    let statusTime : String?
    let statusValue : String?
    let workshopId : String?
    let workshopName : String?
    let shiftName : String?
    
    
    enum CodingKeys: String, CodingKey {
        case brandId = "brandId"
        case compId = "compId"
        case shiftName = "shiftName"
        case equipCode = "equipCode"
        case equipName = "equipName"
        case equipSpec = "equipSpec"
        case factoryDate = "factoryDate"
        case factoryNumber = "factoryNumber"
        case id = "id"
        case originPlace = "originPlace"
        case powerKw = "powerKw"
        case remarkInfo = "remarkInfo"
        case statusFlag = "statusFlag"
        case statusName = "statusName"
        case statusTime = "statusTime"
        case statusValue = "statusValue"
        case workshopId = "workshopId"
        case workshopName = "workshopName"
    }
    
    init(from decoder: Decoder) throws {
        let values = try decoder.container(keyedBy: CodingKeys.self)
        brandId = try values.decodeIfPresent(String.self, forKey: .brandId)
        compId = try values.decodeIfPresent(String.self, forKey: .compId)
        equipCode = try values.decodeIfPresent(String.self, forKey: .equipCode)
        equipName = try values.decodeIfPresent(String.self, forKey: .equipName)
        equipSpec = try values.decodeIfPresent(String.self, forKey: .equipSpec)
        factoryDate = try values.decodeIfPresent(String.self, forKey: .factoryDate)
        factoryNumber = try values.decodeIfPresent(String.self, forKey: .factoryNumber)
        id = try values.decodeIfPresent(String.self, forKey: .id)
        originPlace = try values.decodeIfPresent(String.self, forKey: .originPlace)
        powerKw = try values.decodeIfPresent(String.self, forKey: .powerKw)
        remarkInfo = try values.decodeIfPresent(String.self, forKey: .remarkInfo)
        statusFlag = try values.decodeIfPresent(String.self, forKey: .statusFlag)
        statusName = try values.decodeIfPresent(String.self, forKey: .statusName)
        statusTime = try values.decodeIfPresent(String.self, forKey: .statusTime)
        statusValue = try values.decodeIfPresent(String.self, forKey: .statusValue)
        workshopId = try values.decodeIfPresent(String.self, forKey: .workshopId)
        workshopName = try values.decodeIfPresent(String.self, forKey: .workshopName)
        shiftName = try values.decodeIfPresent(String.self, forKey: .shiftName)
    }
    
}
